{include 'header.tpl'}
<ol class="breadcrumb">
    <li><a href="/adminmall/User/tjAdmin">收入明细</a></li>
</ol>
<form method="get" action="/adminmall/User/tjAdmin" class="form-inline">
    <table>
        <tr>
            <td>
                <label for="form-w" class="control-label">连锁店：</label>
                <select id="shop_id" name="shop_id" class="form-control" >
                    <option value="">--请选择连锁店--</option>
                    {foreach $chainData as $key => $value}
                        <option value="{$value['id']}" {if $smarty.get.shop_id eq $value['id']}selected="selected"{/if}>{$value['name']}</option>
                    {/foreach}
                </select>
            </td>

            <td>
                <label for="form-w" class="control-label">时间范围：</label>
                <input type="text" class="date-picker" id="begin_date" name="begin_date" value="{$start_time}" style="width: 85px;"/> 至 <input type="text" class="date-picker" id="end_date" name="end_date" value="{$end_time}" style="width: 85px;"/>
            </td>

            <td>
                <label for="form-w" class="control-label">手机号码：</label>
                <input type="text"   id="phone" name="phone" value="{$smarty.get.phone}" style="width: 85px;"/>
            </td>

            <td>
                <button type="submit" class="btn btn-primary">查找</button>
                <a href="/adminmall/User/tjAdmin" class="btn btn-danger">清空条件</a>
                <button type="button" onclick="dao()" class="btn btn-primary">导出</button>
            </td>
        </tr>
    </table>
</form>
<div class="clearfix" style="height:30px;"></div>

<table class="fTable" style="width: 60%">
    <thead>
    <tr>
        <th>类型</th>
        <th>收入金额</th>
    </tr>
    </thead>
    <tbody>
    <tr style="color: red;font-size: 110%;">
        <td>当天收入金额</td>
        <td>¥{$tongji['today_income']}</td>
    </tr>
    <tr style="color: red;font-size: 110%;">
        <td>昨天收入金额</td>
        <td>¥{if $tongji['yesterday_income'] eq ""}0.00{else}{$tongji['yesterday_income']}{/if}</td>
    </tr>
    <tr style="color: red;font-size: 110%;">
        <td>周收入金额</td>
        <td>¥{$tongji['week_income']}</td>
    </tr>
    <tr style="color: red;font-size: 110%;">
        <td>本月收入金额</td>
        <td>¥{$tongji['month_income']}</td>
    </tr>
    <tr style="color: red;font-size: 110%;">
        <td>上月收入金额</td>
        {*<td>¥{$tongji['lastmonth_income']}</td>*}
        <td>¥{if $tongji['lastmonth_income'] eq ""}0.00{else}{$tongji['lastmonth_income']}{/if}</td>
    </tr>
    <tr style="color: red;font-size: 110%;">
        <td>所有收入金额</td>
        <td>¥{$tongji['all_income']}</td>
    </tr>
    </tbody>
</table>

<br>
<br>


<table class="table" style="table-layout: fixed;WORD-BREAK: break-all; WORD-WRAP: break-word">
    <tr>
        <td>日期</td>
        <td>订单号</td>
        <td>收货人</td>
        <td>联系方式</td>
        <td>商品金额</td>
        <td>优惠金额</td>
        <td>配送费</td>
        <td>总计金额</td>
        <td>所属连锁店</td>
        <td>接单耗时</td>
        <td>制作耗时</td>
        <td>配送耗时</td>
        <td>总耗时</td>
        <td>配送距离km</td>
        <td>商品结算成本</td>
        <td>本单配送成本</td>
        <td>本单利润</td>


    </tr>
    {foreach from=$data item=item}
        <tr>
            <td>{date("m-d", strtotime($item.create_time))}</td>
            <td>{$item.o_id}</td>
            <td>{$item.contact}</td>
            <td>{$item.phone}</td>
            <td>{$item.price}</td>
            <td>{$item.youhui_price}</td>
            <td>{$item.send_price}</td>
            <td>{$item.pay_price}</td>
            <td>
                {foreach $chainData as $k => $v}
                    {if $v['id'] eq $item.shop_id}{$v['name']}{/if}
                {/foreach}
            </td>
            <td>{Service_Order::timeFormat($item.recv_expend)}</td>
            <td>{Service_Order::timeFormat($item.make_expend)}</td>
            {*{$distribution_time = strtotime($item.complete_time) - strtotime($item.pay_time)}*}
            <td>{Service_Order::timeFormat($item.send_expend)}</td>
            <td>{Service_Order::timeFormat($item.recv_expend + $item.make_expend + $send_expend)}</td>
            <td>{$item.dis}</td>
            <td>{$item.purchase_price_sum}</td>
            <td>{$item.real_send_price}</td>
            <td>{$item.profit}</td>




        </tr>
    {/foreach}
</table>
{include "pager.tpl"}
<script type="text/javascript">
    $(function () {
        create_date_picker();
    });

    function dao(){
        var phone = $('#phone').val();
        var begin_date = $('#begin_date').val();
        var end_date = $('#end_date').val();
        var intentionE1=$("#shop_id option:selected");
        var shop_id = intentionE1.val();
//        alert(intention);
//        alert(nickname);
//        alert(mobile);
//        alert(end_date);

        location.href = "/adminmall/User/orderTjDao?begin_date=" + begin_date + "&end_date=" + end_date + "&phone=" + phone + "&shop_id=" + shop_id;

    }
</script>
{include 'footer.tpl'}